<!DOCTYPE html>
<html class="iframe-h" xmlns:th="http://www.thymeleaf.org">
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>网站后台管理模版</title>
		<link rel="stylesheet" type="text/css" th:href="@{/layui/css/layui.css}"/>
		<link rel="stylesheet" type="text/css" th:href="@{/css/admin.css}"/>
	</head>

	<body>
		<div class="wrap-container clearfix">
				<div class="column-content-detail">
					<form class="layui-form" action="">
						<div class="layui-form-item">
							<div class="layui-inline tool-btn">
								<button class="layui-btn layui-btn-small layui-btn-normal addBtn" data-url="/examine/permission/toAdd"><i class="layui-icon">&#xe654;</i></button>
								<button class="layui-btn layui-btn-small layui-btn-danger delBtn"  data-url="/examine/permission/delete"><i class="layui-icon">&#xe640;</i></button>
								<button class="layui-btn layui-btn-small layui-btn-normal updateBtn"  data-url="/examine/permission/toUpdate"><i class="layui-icon">&#xe642;</i></button>
							</div>
						</div>
					</form>
					<table class="layui-table" lay-data="{height: 'full', cellMinWidth: 80,  limit:15,limits:[15,30],
						url:'/examine/permission/list', page:true, id:'test'}" lay-filter="test" id="test">
						<thead>
						<tr>
							<th lay-data="{type:'checkbox'}">ID</th>
							<th lay-data="{field:'id',align:'center'}">id</th>
							<th lay-data="{field:'name',align:'center'}">名称</th>
							<th lay-data="{field:'nameCode', align:'center'}">角色权限</th>
							<th lay-data="{field:'status', align:'center',templet: '#checkboxTpl'}">状态</th>
						</tr>
						</thead>
					</table>

				</div>
		</div>

		<script type="text/html" id="checkboxTpl">
			<input type="checkbox" name="lock" value="{{d.id}}" title="禁用" lay-filter="lockDemo" {{ d.status == 1?'checked':''}}>
		</script>

		<script th:src="@{/layui/layui.js}" type="text/javascript" charset="utf-8"></script>
		<script th:src="@{/js/common.js}" type="text/javascript" charset="utf-8"></script>
		<script>



			layui.use(['table','tree','jquery'], function() {
				var table = layui.table,
						form = layui.form,
						$ = layui.jquery,
						tree = layui.tree;

				//获取当前iframe的name值
				var iframeObj = $(window.frameElement).attr('name');

				form.on('checkbox(lockDemo)', function(obj){
					//do more thing
					//layer.tips(this.value + ' ' + this.name + '：'+ obj.elem.checked, obj.othis);
					$.ajax({
						url:'/examine/permission/changeStatus?id='+this.value+"&boolStatus="+new Boolean(obj.elem.checked),
						type: 'post',
						dataType:'json',
						success:function (data){
							if(data.code === 200){
								layer.msg("修改成功");
							}
						}
					});
				});



			});

		</script>
	</body>

</html>